﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FrmCall_msg.aspx.cs" Inherits="Web.AdminPage.FrmCall_msg" %>

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <link href="../css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="../css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="../css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
    <link href="../css/animate.css" rel="stylesheet">
    <link href="../css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div id="tools">
            <div role="form" class="form-inline ">
                <div class="ibox float-e-margins">
                    <div class="form-group">
                        <input type="text" placeholder=" 客户ID" id="client_id" name="client_id" class="form-control">
                    </div>
                   
                    <div class="form-group">
                        <input type="text" placeholder=" 内容" id="contents" name="contents" class="form-control">
                    </div>
                    <div class="form-group">
                        <input type="text" placeholder="创建时间 " id="create_time" name="create_time" class="form-control">
                    </div>
                    <div class="form-group">
                        <input type="text" placeholder=" 订单编号" id="order_number" name="order_number" class="form-control">
                    </div>
                    <button class="btn btn-white" type="button" onclick="search(0)">查询</button>
                    
                </div>
            </div>
        </div>
    </div>
    <div class="ibox float-e-margins">

        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">

                    <div class="example">
                        <table id="tb" data-mobile-responsive="true"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <script src="../js/jquery.min.js"></script>
    <script src="../js/bootstrap.min.js?v=3.3.6"></script>
    <!-- 自定义js -->
    <script src="../js/content.js?v=1.0.0"></script>
    <!-- Bootstrap table -->
    <script src="../js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="../js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
    <script src="../js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <!-- Peity -->
    <script src="../js/demo/bootstrap-table-demo.js"></script>
    <script src="../js/plugins/layer/laydate/laydate.js"></script>
    <script>
        function fmartdate_new(timestamp) {

            var date = new Date(parseInt(timestamp.replace("/Date(", "").replace(")/", ""), 10));
            Y = date.getFullYear() + '-';
            M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
            D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
            h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
            m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
            s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
            return Y + M + D + h + m + s;
        }
        function formatDate(inputTime) {
            var date = new Date(inputTime);
            var y = date.getFullYear();
            var m = date.getMonth() + 1;
            m = m < 10 ? ('0' + m) : m;
            var d = date.getDate();
            d = d < 10 ? ('0' + d) : d;
            var h = date.getHours();
            h = h < 10 ? ('0' + h) : h;
            var minute = date.getMinutes();
            var second = date.getSeconds();
            minute = minute < 10 ? ('0' + minute) : minute;
            second = second < 10 ? ('0' + second) : second;
            return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
        }
        var tb = $('#tb').bootstrapTable({
            url: "../Hanlder/Call_msgHandler.ashx?Method=GetList",
            toolbarAlign: "left",
            toolbar: "#tools",
            iconSize: 'outline',
            showColumns: true,
            pagination: true,
            pageSize: 5,
            pageList: [5, 10, 15, 20],
            icons: {
                refresh: 'glyphicon-repeat',
                toggle: 'glyphicon-list-alt',
                columns: 'glyphicon-list'
            },
            columns: [
{
    field: 'Id',
    title: 'ID ',
    align: 'center',
    width: 'auto'
},
{
    field: 'client',
    title: '客户 ',
    align: 'center',
    width: 'auto'
},
{
    field: 'contents',
    title: '内容 ',
    align: 'center',
    width: 'auto'
},
{
    field: 'create_time',
    title: '创建时间 ',
    align: 'center',
    width: 'auto'
, formatter: function (value, row, index) {
    return fmartdate_new(value);
}
},
{
    field: 'order_number',
    title: ' 订单编号',
    align: 'center',
    width: 'auto'
},
{
    field: 'Id',
    title: '操作',
    align: 'center',
    formatter: function (value, row, index) {

        var str = "";
        str += "<a href=\"javascript:void(0)\" onclick=\"Edit(" + row.Id + ")\">编辑</a>";
        str += "&nbsp;&nbsp;&nbsp;";
        str += "<a href=\"javascript:void(0)\" onclick=\"Del(" + row.Id + ")\">删除</a>";
       
        return str;


    }
}
            ],
            queryParams: function (params) {
                //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                var temp = {
                    client: $("#client").val(),
                    contents: $("#contents").val()
 
                  
                };
                return temp;
            }
        });


function Edit(Id) {
    var index = parent.layer.open({
        type: 2,
        title: '编辑',
        shadeClose: true,
        shade: 0.8,
        area: ['80%', '60%'],
        content: '../AdminPage/FrmCall_msgEdit.aspx?Id=' + Id,
        end: function () {

            parent.layer.close(index);
            $('#tb').bootstrapTable('refresh');

        }
    });
}
//HF

function HF(Id) {
    var index = parent.layer.open({
        type: 2,
        title: '编辑',
        shadeClose: true,
        shade: 0.8,
        area: ['80%', '60%'],
        content: '../AdminPage/FrmAdminCallMsg.aspx?Id=' + Id,
        end: function () {

            parent.layer.close(index);
            $('#tb').bootstrapTable('refresh');

        }
    });
}
function search() {
    $('#tb').bootstrapTable('refresh');
}
function getAllcks(callback) {
    var getSelectRows = $.map($("#tb").bootstrapTable('getSelections'), function (row) {
        return row;
    });
    var ids = new Array();//定义js数组用于存放自己所需的值
    for (var i = 0; i < getSelectRows.length; i++) {
        ids[i] = getSelectRows[i].Id;
    }
    callback(ids);
}

//do_frozen

function Del(Id) {
    $.ajax({
        type: 'post',
        url: '../Hanlder/Call_msgHandler.ashx?Method=Del',
        data: { Id: Id },

        success: function (data) {
            var res = $.parseJSON(data);

            if (res.states == 0) {
                parent.layer.msg("操作成功");
            } else {
                parent.layer.msg(res.msg);
            }
            tb.bootstrapTable('refresh');
        }
    });
}


    </script>
</body>
</html>
